package com.lagou.goods.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lagou.common.pojo.Goods;
import com.lagou.goods.mapper.GoodsMapper;
import com.lagou.goods.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class GoodsServiceImpl implements GoodsService {
    @Autowired
    private GoodsMapper goodsMapper;

    @Override
    public Goods queryById(Integer id) {
        return goodsMapper.selectById(id);
    }

    @Override
    public Integer updateById(Goods goods) {
        return goodsMapper.updateById(goods);
    }

    @Override
    public Integer deleteById(Integer id) {
        return goodsMapper.deleteById(id);
    }

    @Override
    public List<Goods> queryAll() {
        IPage<Goods> page = new Page<>(0,10);
        page = goodsMapper.selectPage(page,null);
        return page.getRecords();
    }


}
